#ifndef __WIDGET_HPP__
#define __WIDGET_HPP__

#include <object.hpp>

namespace gtkhpp {

class Widget : public Object{
public:
    enum EventType {
        BUTTON_PRESS_MASK = GDK_BUTTON_PRESS_MASK
    };
    void add_events(EventType events);
    enum StateType {
        STATE_NORMAL 	= GTK_STATE_NORMAL,
        STATE_ACTIVE 	= GTK_STATE_ACTIVE,
        STATE_PRELIGHT 	= GTK_STATE_PRELIGHT,
        STATE_SELECTED 	= GTK_STATE_SELECTED,
        STATE_INSENSITIVE = GTK_STATE_INSENSITIVE,
        //		STATE_INCONSISTENT = GTK_STATE_INCONSISTENT,
        //		STATE_FOCUSED	= GTK_STATE_FOCUSED
    };
    enum ColorType {
        BLACK,
        RED,
        BLUE,
        GREEN
    };
    void set_backgroup(const StateType &state, const GdkColor &color);
    void set_backgroup(const StateType &state, const ColorType &color);
protected:
    Widget(Object *parent): Object(parent) {}
};

inline void Widget::add_events(EventType events)
{
    gtk_widget_add_events(GTK_WIDGET(obj), events);
}

inline void Widget::set_backgroup(const StateType &state, const GdkColor &color)
{
    gtk_widget_modify_bg(GTK_WIDGET(obj), (GtkStateType)state, &color);
}

inline void Widget::set_backgroup(const StateType &state, const ColorType &color)
{
    GdkColor c = {0x0, 0x0, 0x0, 0x0};

    switch (color) {
    case BLACK:
        break;
    case RED:
        c.red = 0xffff;
        break;
    case GREEN:
        c.green = 0xffff;
        break;
    case BLUE:
        c.blue = 0xffff;
        break;
    default:
        break;
    }
    set_backgroup(state, c);
}

} // namespace gtkhpp

#endif /* end of include guard */
